package java68_6;

public class Teacher2 {
    private String name;
    private int age;
    private String postion,education;

//    public Teacher2(){
//        name="无名";
//        age=22;
//        postion="待定";
//        education="不详";
//    }
    public Teacher2(String n,int a,String p,String e){
        name=n;
        //age=a;
        setAge(a);//!!!!!!!!!!!

        postion=p;
        education=e;
    }
    public Teacher2(String n,int a){
        name=n;
        setAge(a);
    }
    public Teacher2(String n,String p){
        name=n;
        postion=p;
    }
//    public Teacher2(String n,String e){
//        name=n;
//        education=e;
//    }
    public String getPostion() {
        return postion;
    }

    public void setPostion(String postion) {
        //Teacher2("xx",22,postion,"benke");
        this.postion = postion;
    }

    public String getEducation() {
        return education;
    }

    public void setEducation(String education) {
        this.education = education;
    }

    public void selfIntro(){
        System.out.println("我的名字叫"+name+",今年"+age+"岁");
        System.out.println("学历是"+education+",职务是"+postion);
    }
    //读
    public String getName(){
        return name;
    }
    //写
    public void setName(String n){
        this.name=n;
    }
//    public void setName(String name){
//        this.name=name;
//    }
    public int getAge(){
        return age;
    }
    //限制年龄不能小于22岁
    public void setAge(int a){
        if(a<22){
            System.out.println("年龄太小了,才"+a+"岁");
            a=22;
        }
        age=a;
    }

    private void  showCixiu(){
        System.out.println(name+"在大腿上有纹身");
    }
}
